﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common.Utilities
{
    /// <summary>
    /// 3 parts representation of DB object (table, view)
    /// </summary>
    [Serializable]
    public class DbEntity
    {
        private string _DbName;
        /// <summary></summary>
        public string DbName
        {
            get
            {
                return this._DbName;
            }
            set
            {
                this._DbName = value;
            }
        }

        private string _SchemaName;
        /// <summary></summary>
        public string SchemaName
        {
            get
            {
                return this._SchemaName;
            }
            set
            {
                this._SchemaName = value;
            }
        }

        private string _EntityName;
        /// <summary></summary>
        public string EntityName
        {
            get
            {
                return this._EntityName;
            }
            set
            {
                this._EntityName = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="tblName"></param>
        public DbEntity(string tblName)
        {
            this._DbName = string.Empty;
            this._SchemaName = "dbo";
            this._EntityName = tblName;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="schema"></param>
        /// <param name="tblName"></param>
        public DbEntity(string schema, string tblName):this(tblName)
        {
            this._SchemaName = schema;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dbName"></param>
        /// <param name="schemaName"></param>
        /// <param name="tblName"></param>
        public DbEntity(string dbName, string schemaName, string tblName):this(schemaName, tblName)
        {
            this._DbName = dbName;
        }
    }
}
